import { ColumnGroupType, ColumnType } from "antd/es/table"

import { handleNumber } from "@/utils/util"

const memberVirtualManage = (newFormat: (arg: string) => string): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	memberVirtualTypeAndProtocol: {
		key: "memberVirtualManage_TypeAndProtocol",
		width: 150,
		title: (
			<>
				<span>{newFormat("member.virtual_type")}</span>
				<br />
				<span>{newFormat("member.virtual_protocol")}</span>
			</>
		),
		render: (_text: string, record: any) => {
			return (
				<>
					<span>{record.virtualKind || "-"}</span>
					<br />
					<span>{record.virtualProtocol || "-"}</span>
				</>
			)
		},
		align: "center"
	},
	memberVirtualProxyTotalAmount: {
		key: "memberVirtualManage_TotalAmount",
		dataIndex: "bindNum",
		width: 180,
		title: newFormat("member.agent_total_amount"),
		render: (_text: string, record: any) => {
			return handleNumber(record.currency, record.proxyTotalAmount)
		},
		align: "center"
	},
	memberVirtualProxyBindCount: {
		key: "memberVirtualManage_BindCount",
		dataIndex: "bind_count",
		width: 180,
		title: newFormat("common.components.bind_count"),
		render: (_text: string, record: any) => <span>{record.bindNum || "0"}</span>,
		align: "center"
	}
})

export default memberVirtualManage
